{% extends 'base.html' %}
{% load static cmstags %}
{% load_settings as settings %}
{% block css %}
    <link rel="stylesheet" href="{% static 'css/category.css' %}"/>
{% endblock %}
{% block js %}{% endblock %}
{% block seo %}
    {% if category %}
        <title>{{ category.name }} - {{ settings.site_title }}</title>
    {% else %}
        <title>全部分类 - {{ settings.site_title }}</title>
    {% endif %}

    {% if category.keywords and category.description %}
        <meta name="keywords" content="{{ category.keywords }}"/>
        <meta name="description" content="{{ category.description }}"/>
    {% else %}
        <meta name="keywords" content="{{ settings.keywords }}"/>
        <meta name="description" content="{{ settings.description }}"/>
    {% endif %}
{% endblock %}

{% block main %}
    {% get_all_category as categorys %}
    <div class="all-category clearfix">
        <a href="{% url 'category_all' %}" {% if not alias %} class="active" {% endif %}>全部</a>
        {% for item in categorys %}
            <a href="{% url 'category' item.alias %}" {% if item.alias == alias %}
               class='active' {% endif %}> {{ item.name }}</a>
        {% endfor %}
    </div>
    {% get_category alias current_page 10 as data %}
    {% for item in data.list %}
        <div class="article-item clearfix">
            <div class="cover">
                <a href="{% url 'article' item.category__alias item.id %}" target="_blank">
                    <img src="{{ item.cover }}" alt="{{ item.title }}">
                </a>
            </div>
            <div class="content">
                <div class="title">
                    <h5>
                        <a href="{% url 'article' item.category__alias item.id %}"
                           target="_blank">{{ item.title }}</a>
                    </h5>
                </div>
                <div class="summary">{{ item.summary }}</div>
                <div class="info">

                    <span class="iconfont icon-book"></span>
                    <span><a href="{% url 'category' item.category__alias %}"
                             target="_blank">{{ item.category__name }}</a></span>

                    <span class="iconfont icon-date"></span>
                    <span>{{ item.create_date }}</span>

                    <span class="iconfont icon-yanjing"></span>
                    <span>{{ item.hits }}</span>
                </div>
            </div>
        </div>
    {% endfor %}
    {% get_paginator data.num_pages current_page 8 data.url %}
{% endblock %}